<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        window.onload = function(){
            let fruit = prompt("请输入水果名称");
            let weight = prompt("请输入购买的重量");
            let price = 0;
            switch(fruit){
                case '苹果':
                    price = 3.5 * weight;
                    document.write('<div>购买苹果'+weight+'斤，价格为'+price+'元</div>')
                    break;
                    case '榴莲':
                    price = 35 * weight;
                    document.write('<div>购买苹果'+weight+'斤，价格为'+price+'元</div>')
                    break;
                    case '香梨':
                    price = 4.5 * weight;
                    document.write('<div>购买苹果'+weight+'斤，价格为'+price+'元</div>')
                    break;
            }
        }
    </script>
</head>
<body>
    
</body>
</html>